# -*- coding: utf-8 -*-
# web wsgi接口

# environ：一个包含所有HTTP请求信息的dict对象；
# start_response：一个发送HTTP响应的函数。
def application(environ,start_response):
	start_response('200 OK',[('Content-Type','text/html')])
	with open('test.html') as f:
		body = f.read()
		return [body.encode('utf-8')]

from wsgiref.simple_server import make_server


#创建一个服务器，IP地址微孔，端口为8000，处理函数是application
httpd = make_server('',8000,application)
print('Serving HTTP on port 8000...')

#开始监听HTTP请求
httpd.serve_forever()
